package com.wow.wa.ui;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.wow.wa.ui.bean.UICategory;

public class CategoryAdatper extends BaseAdapter {

	private List<UICategory> categorys;
	private Context ct;

	public CategoryAdatper(List<UICategory> categorys, Context ct) {
		this.categorys = categorys;
		this.ct = ct;

	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return this.categorys.size();
	}

	@Override
	public UICategory getItem(int arg0) {
		// TODO Auto-generated method stub
		return categorys.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		final View view = LayoutInflater.from(this.ct).inflate(
				com.wow.wa.uicommon.R.layout.item_view, null);
		final UICategory category = categorys.get(arg0);
		TextView name = (TextView) view
				.findViewById(com.wow.wa.uicommon.R.id.name);
		name.setText(category.getName());
		return view;
	}

}
